import request from '@/utils/request'

export function fetchList(query, type) {
  return request({
    url: '/order/query/list/' + type,
    method: 'get',
    params: query
  })
}

export function getTotal(data) {
  return request({
    url: '/order/query/total',
    method: 'get',
    data
  })
}

export function searchList(data) {
  return request({
    url: '/order/query',
    method: 'get',
    params: data
  })
}

export function getDetail(data) {
  return request({
    url: '/publish/get/' + data,
    method: 'get'
  })
}
export function close(data, type) {
  return request({
    url: '/publish/shut/' + type + '/' + data,
    method: 'put'
  })
}

export function getSetting() {
  return request({
    url: '/setting/get/setting',
    method: 'get'
  })
}
export function addSetting(data) {
  return request({
    url: '/setting/save/setting',
    method: 'post',
    data: data
  })
}
export function deleteSetting(id) {
  return request({
    url: '/setting/delete/setting/' + id,
    method: 'DELETE'
  })
}

// 设置订单配置
export function orderSetting(data) {
  return request({
    url: '/setting/get/order/setting',
    method: 'get',
    params: data
  })
}
export function getMoney(data) {
  return request({
    url: '/setting/get/money/setting',
    method: 'get',
    params: data
  })
}

export function saveOrderSetting(data) {
  return request({
    url: '/setting/save/order/setting',
    method: 'put',
    data: data
  })
}
export function saveKmMoney(data) {
  return request({
    url: '/setting/save/money/setting/' + data,
    method: 'put',
    data: data
  })
}
export function createArticle(data) {
  return request({
    url: '/publish/create',
    method: 'post',
    data: data
  })
  // return
}
export function updateArticle(data, id) {
  return request({
    url: '/publish/edit/' + id,
    method: 'put',
    data: data
  })
}
export function operation(id, type) {
  return request({
    url: '/publish/operation/' + id + '/' + type,
    method: 'put',
    data: type
  })
}
